﻿using MongoDB.Bson.Serialization.Attributes;
using System;
using System.ComponentModel.DataAnnotations;

namespace BCDto.Location
{
    /// <summary>
    /// 表示位置坐标的类型。
    /// </summary>
    [BsonIgnoreExtraElements]
    public class CoordinateBsonDto
    {
        private double logitude;
        private double latitude;
        /// <summary>
        /// 经度。
        /// </summary>
        [Display(Name = "经度")]
        [Required(ErrorMessage = "{0} 不能为空")]
        public double Longitude
        {
            get { return this.logitude; }
            set { this.logitude = Math.Round(value, 8); }
        }

        /// <summary>
        /// 纬度。
        /// </summary>
        [Display(Name = "纬度")]
        [Required(ErrorMessage = "{0} 不能为空")]
        public double Latitude
        {
            get { return this.latitude; }
            set { this.latitude = Math.Round(value, 8); }
        }
    }
}
